<template>
  <view :style="themeColor">
    <view class="page">
      <fu-custom bgColor="bg-white" :isBack="true" :isBottom="true">
        <block slot="content">{{type==1? '姓名/昵称' :type==2? '公司名称' : ''}}</block>
        <block slot="right">
          <view class="text-df" @click.stop="confirmModificationFunc">保存</view>
        </block>
      </fu-custom>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout modifyNickname_flex_1">
        <view class='flex flex-wrap align-center justify-between modifyNickname_fd1_0'>
          <input v-if="type==1" type="text" :placeholder="`请输入`" confirm-type="done" :maxlength="-1"
            placeholder-style="color:#999;font-size:32rpx" v-model="nickname" />
          <input v-if="type==2" type="text" :placeholder="`请输入`" confirm-type="done" :maxlength="-1"
            placeholder-style="color:#999;font-size:32rpx" v-model="company" />
          <!-- <image class='modifyNickname_fd1_0_c1' mode="aspectFit" :src='STATIC_URL+"19.png"'
            @tap.stop="cleanNicknameFunc()"></image> -->
        </view>
      </view>
      <!-- <view class="text-sm text-999 margin-lg ">请设置2-24个字符，不包含@》/等无效字符</view> -->

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "modificationName": {
          "userinfo": {
            "id": "",
            "avatar": "",
            "real_name": "",
            "nickname": "",
            "email": "",
            "gender": "",
            "mobile": "",
            "birthday": "",
            "client_id": "",
            "phone": ""
          }
        },
        "nickname": "",
        company: '',
        type: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        nickname,
        company,
        type
      } = options
      if (nickname !== undefined) this.nickname = nickname
      if (company !== undefined) this.company = company
      if (type !== undefined) this.type = type
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //确定修改
      async confirmModificationFunc() {
        if (this.type == 1) {
          if (!validate(this.nickname, 'require')) {
            this.$message.info('昵称不能为空');
            return false;
          }
          uni.$emit('name', this.nickname)
          this.$urouter.navigateBack(1);
          return;
        }
        if (this.type == 2) {
          if (!validate(this.company, 'require')) {
            this.$message.info('昵称不能为空');
            return false;
          }
          uni.$emit('company', this.company)
          this.$urouter.navigateBack(1);
          return;
        }

      },
      //清除昵称
      cleanNicknameFunc() {
        this.nickname = '';
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .modifyNickname_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .modifyNickname_fd0_0_c2_c0 {
    color: rgba(255, 114, 13, 1);
    font-size: 32rpx;
  }

  .modifyNickname_fd0_0_c1 {
    color: #333333;
    font-size: 36rpx;
    font-weight: 700;
  }

  .modifyNickname_fd0_0_c0_c0_c0 {
    color: var(--benbenFontColor0);
    line-height: 36rpx;
  }

  .modifyNickname_fd0_0_c0_c0 {
    height: 50rpx;
    width: 50rpx;
  }

  .modifyNickname_fd0_0_c0 {
    width: 140rpx;
  }

  .modifyNickname_fd0_0 {
    line-height: 88rpx;
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .modifyNickname_flex_1 {
    padding: 28rpx 32rpx 0rpx 32rpx;
  }

  .modifyNickname_fd1_0_c1 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .modifyNickname_fd1_0 {
    // border-bottom: 1px solid #eee;
    background: #f8f8f8;
    color: #333333;
    width: 702rpx;
    padding: 28rpx;
    border-radius: 16rpx;
  }
</style>
